package com.itheima;

import java.awt.*;

public class Airplane {
    private int x, y;
    private final int width = 50;
    private final int height = 50;

    public Airplane(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public void moveLeft() {
        x -= 5;
    }

    public void moveRight() {
        x += 5;
    }

    public void draw(Graphics g) {
        // 绘制飞机
        g.setColor(Color.CYAN);
        g.fillOval(x, y, width, height);

        // 绘制飞机机翼
        g.setColor(Color.LIGHT_GRAY);
        g.fillRect(x - 10, y + 20, width + 20, 10);
    }
}
